package com.yangrd.helper.crudhelper.common;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * description: Result
 *
 * @author: yangrd
 * @date: 2020/9/14
 * @version: 1.0
 */
@RequiredArgsConstructor(staticName = "of")
@Getter
public class Result<T> {

    private final int status;

    private final String msg;

    private final T data;

    public static <T> Result<T> success() {
        return Result.of(0, "操作成功", null);
    }

    public static <T> Result<T> success(T data) {
        return Result.of(0, "操作成功", data);
    }

    public static <T> Result<T> fail(String msg) {
        return Result.of(-1, msg, null);
    }

}
